package com.hzhjhh.view.cashierView;

import java.util.Vector;

import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import com.hzhjhh.init.dialog.Mytable;
import com.hzhjhh.view.cashierView.constant.ShowConstants;

/**
 * 组件初始化-收银页面-取消交易
 * @author 12083
 *
 */
public class CancelDealInit {

	/**
	 * 初始化取消交易-按钮
	 */
	public static JButton initBt(JTextField vipCardId, JTable table, JScrollPane jScrollPane) {
		JButton cancelDeal = new JButton();
		cancelDeal.setBounds(685, 489, 96, 25);
		cancelDeal.setText("交易取消");
		JTable jTable = table;
		cancelDeal.addActionListener(event -> {
			vipCardId.setEditable(true);
			vipCardId.setText("");
			// 把表装入容器
			jScrollPane.getViewport().add(
				// 显示内容
				Mytable.maketable(new Vector<>(), ShowConstants.MERCHANDISE_HEAD)
			); 
		});
		return cancelDeal;
	}
}
